data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, constrained)
}
plot(1, type="l", xlab=expression(italic(z[i](cabinet))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.07), col=NULL)
#abline(v=0, lty=2, lwd=2, col="darkgrey")
den1<-density(bucket2[,1][bucket2[,3]==1],bw = 3)
lines(den1$x[abs(den1$x)<50],den1$y[abs(den1$x)<50], lty=1)
den6<-density(bucket2[,1][bucket2[,3]==6],bw = 3)
lines(den6$x[abs(den6$x)<50],den6$y[abs(den6$x)<50], lty=2)
mtext(expression(paste( italic(z[PM])==-25, ",  ", italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('b', col='grey', line = -1, side=1, adj=0.99)
legend('topright', c(expression(italic(S==1)), expression(italic(S==6))),
lty=c(1,2),
bty='n', lwd=1,ncol=2, cex=1 ,merge = F )
bucket2<-NULL
for (i in 1:1000){
#simple case, no constraint
competence <- runif(100, 0.000001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<-0
combined <- abs(pmpos-distance)/(competence*lambda)
data<-cbind(competence, distance, combined,
c(rep(0,50),rep(1,50)))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, constrained)
}
plot(1, type="l", xlab=expression(italic(z[i](cabinet))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.07), col=NULL)
#abline(v=0, lty=2, lwd=2, col="darkgrey")
den1<-density(bucket2[,1][bucket2[,3]==1],bw = 3)
lines(den1$x[abs(den1$x)<50],den1$y[abs(den1$x)<50], lty=1)
den6<-density(bucket2[,1][bucket2[,3]==6],bw = 3)
lines(den6$x[abs(den6$x)<50],den6$y[abs(den6$x)<50], lty=2)
mtext(expression(paste( italic(z[PM])==0, ",  ", italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('c', col='grey', line = -1, side=1, adj=0.99)
bucket2<-NULL
for (i in 1:1000){
#simple case, no constraint
competence <- runif(100, 0.000001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<--40
combined <- abs(pmpos-distance)/(competence*lambda)
data<-cbind(competence, distance, combined,
c(rep(0,50),rep(1,50)))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, constrained)
}
plot(1, type="l", xlab=expression(italic(z[i](cabinet))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.07), col=NULL)
#abline(v=0, lty=2, lwd=2, col="darkgrey")
den1<-density(bucket2[,1][bucket2[,3]==1],bw = 3)
lines(den1$x[abs(den1$x)<50],den1$y[abs(den1$x)<50], lty=1)
den6<-density(bucket2[,1][bucket2[,3]==6],bw = 3)
lines(den6$x[abs(den6$x)<50],den6$y[abs(den6$x)<50], lty=2)
mtext(expression(paste( italic(z[PM])==-40, ",  ", italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('d', col='grey', line = -1, side=1, adj=0.99)
z_pm<-seq(-50,0)
lambda<-10
bucket5<-NULL
for (i in 1:length(z_pm)){
#simple case, no constraint
competence <- runif(100, 0.00001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<- z_pm[i]
combined <- abs(pmpos-distance)/(competence*lambda)
data<-as.data.frame(cbind(competence, distance, combined,
c(rep(0,50),rep(1,50))))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S, z_pm[i], mean(alpha_i),sd(z_i))
bucket5<- rbind(bucket5, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S, z_pm[i], mean(alpha_i),sd(z_i))
bucket5<- rbind(bucket5, constrained)
}
plot(1, type="l", xlab=expression(italic(z[pm])),
ylab=expression(italic(mean(alpha[i](cabinet)))), xlim=range(z_pm),
ylim=c(0,1), col=NULL)
points(bucket5[,4][bucket5[,3]==1],bucket5[,5][bucket5[,3]==1],col='grey')
points(bucket5[,4][bucket5[,3]==1],bucket5[,5][bucket5[,3]==6],pch=2,col='grey')
lo1<-loess(bucket5[,5][bucket5[,3]==1]~bucket5[,4][bucket5[,3]==1],
span=1)
lines(lo1$x,lo1$fitted,lwd=1.5, lty=1)
lo6<-loess(bucket5[,5][bucket5[,3]==6]~bucket5[,4][bucket5[,3]==6],
span=1)
lines(lo6$x,lo6$fitted,lwd=1.5, lty=2)
mtext(expression(paste( italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('e', col='grey', line = -1, side=1, adj=0.99)
legend('bottomleft', c(expression(italic(S==1)), expression(italic(S==6))),
pch=c(1,2),
bty='n',ncol=2,col = 'grey',cex=1)
plot(1, type="l", xlab=expression(italic(z[pm])),
ylab=expression(italic(sd(z[i](cabinet)))), xlim=range(z_pm),
ylim=c(0,25), col=NULL)
points(bucket5[,4][bucket5[,3]==1],bucket5[,6][bucket5[,3]==1], col='grey')
points(bucket5[,4][bucket5[,3]==1],bucket5[,6][bucket5[,3]==6],pch=2, col='grey')
mtext(expression(paste( italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
lo1<-loess(bucket5[,6][bucket5[,3]==1]~bucket5[,4][bucket5[,3]==1],
span=1)
lines(lo1$x,lo1$fitted,lwd=1.5,lty=1)
lo6<-loess(bucket5[,6][bucket5[,3]==6]~bucket5[,4][bucket5[,3]==6],
span=1)
lines(lo6$x,lo6$fitted,lwd=1, lty=2)
mtext('f', col='grey', line = -1, side=1, adj=0.99)
par(mfrow=c(3,2))
lambda=10
bucket<-NULL
for (i in 1:1000){
#simple case, no constraint
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
bucket<- c(bucket, distance)
}
plot(1, type="l", xlab=expression(italic(z[i](MPs))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.06), col=NULL)
lines(density(bucket), lty=6)
mtext('a', col='grey', line = -1, side=1, adj=0.99)
legend('topright', 'MPs',
lty=c(6),
bty='n', lwd=1,ncol=1, cex=1 ,merge = F )
bucket2<-NULL
for (i in 1:1000){
#simple case, no constraint
competence <- runif(100, 0.000001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<--25
combined <- abs(pmpos-distance)/(competence*lambda)
data<-cbind(competence, distance, combined,
c(rep(0,50),rep(1,50)))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, constrained)
}
plot(1, type="l", xlab=expression(italic(z[i](cabinet))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.07), col=NULL)
#abline(v=0, lty=2, lwd=2, col="darkgrey")
den1<-density(bucket2[,1][bucket2[,3]==1],bw = 3)
lines(den1$x[abs(den1$x)<50],den1$y[abs(den1$x)<50], lty=1)
den6<-density(bucket2[,1][bucket2[,3]==6],bw = 3)
lines(den6$x[abs(den6$x)<50],den6$y[abs(den6$x)<50], lty=2)
mtext(expression(paste( italic(z[PM])==-25, ",  ", italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('b', col='grey', line = -1, side=1, adj=0.99)
legend('topright', c(expression(italic(S==1)), expression(italic(S==6))),
lty=c(1,2),
bty='n', lwd=1,ncol=2, cex=1 ,merge = F )
bucket2<-NULL
for (i in 1:1000){
#simple case, no constraint
competence <- runif(100, 0.000001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<-0
combined <- abs(pmpos-distance)/(competence*lambda)
data<-cbind(competence, distance, combined,
c(rep(0,50),rep(1,50)))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, constrained)
}
plot(1, type="l", xlab=expression(italic(z[i](cabinet))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.07), col=NULL)
#abline(v=0, lty=2, lwd=2, col="darkgrey")
den1<-density(bucket2[,1][bucket2[,3]==1],bw = 3)
lines(den1$x[abs(den1$x)<50],den1$y[abs(den1$x)<50], lty=1)
den6<-density(bucket2[,1][bucket2[,3]==6],bw = 3)
lines(den6$x[abs(den6$x)<50],den6$y[abs(den6$x)<50], lty=2)
mtext(expression(paste( italic(z[PM])==0, ",  ", italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('c', col='grey', line = -1, side=1, adj=0.99)
bucket2<-NULL
for (i in 1:1000){
#simple case, no constraint
competence <- runif(100, 0.000001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<--40
combined <- abs(pmpos-distance)/(competence*lambda)
data<-cbind(competence, distance, combined,
c(rep(0,50),rep(1,50)))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S)
bucket2<- rbind(bucket2, constrained)
}
plot(1, type="l", xlab=expression(italic(z[i](cabinet))),
ylab="Density", xlim=c(-50,50), ylim=c(0,0.07), col=NULL)
#abline(v=0, lty=2, lwd=2, col="darkgrey")
den1<-density(bucket2[,1][bucket2[,3]==1],bw = 3)
lines(den1$x[abs(den1$x)<50],den1$y[abs(den1$x)<50], lty=1)
den6<-density(bucket2[,1][bucket2[,3]==6],bw = 3)
lines(den6$x[abs(den6$x)<50],den6$y[abs(den6$x)<50], lty=2)
mtext(expression(paste( italic(z[PM])==-40, ",  ", italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('d', col='grey', line = -1, side=1, adj=0.99)
z_pm<-seq(-50,0)
lambda<-10
bucket5<-NULL
for (i in 1:length(z_pm)){
#simple case, no constraint
competence <- runif(100, 0.00001, 1)
leftFaction <-(rbeta(50,2,7))*50
rightFaction <- (-(rbeta(50,2,7))*50)+50
distance <- -c(leftFaction,rightFaction)
pmpos<- z_pm[i]
combined <- abs(pmpos-distance)/(competence*lambda)
data<-as.data.frame(cbind(competence, distance, combined,
c(rep(0,50),rep(1,50))))
cabinet<-
rbind(data[data[,4]==0,][order(data[data[,4]==0,][,3]),][1:6,],
data[data[,4]==1,][order(data[data[,4]==1,][,3]),][1:6,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 1
unconstrained <- cbind(z_i, alpha_i, S, z_pm[i], mean(alpha_i),sd(z_i))
bucket5<- rbind(bucket5, unconstrained)
# harder case, with 6 equal states
data<-data[sample(nrow(data)),]
data1<- data[1:16,]
data2<- data[17:32,]
data3<- data[33:49,]
data4<- data[50:66,]
data5<- data[67:83,]
data6<- data[84:100,]
cabinet <-
rbind(data1[data1[,4]==0,][order(data1[data1[,4]==0,][,3]),][1,],
data1[data1[,4]==1,][order(data1[data1[,4]==1,][,3]),][1,],
data2[data2[,4]==0,][order(data2[data2[,4]==0,][,3]),][1,],
data2[data2[,4]==1,][order(data2[data2[,4]==1,][,3]),][1,],
data3[data3[,4]==0,][order(data3[data3[,4]==0,][,3]),][1,],
data3[data3[,4]==1,][order(data3[data3[,4]==1,][,3]),][1,],
data4[data4[,4]==0,][order(data4[data4[,4]==0,][,3]),][1,],
data4[data4[,4]==1,][order(data4[data4[,4]==1,][,3]),][1,],
data5[data5[,4]==0,][order(data5[data5[,4]==0,][,3]),][1,],
data5[data5[,4]==1,][order(data5[data5[,4]==1,][,3]),][1,],
data6[data6[,4]==0,][order(data6[data6[,4]==0,][,3]),][1,],
data6[data6[,4]==1,][order(data6[data6[,4]==1,][,3]),][1,])
z_i <- cabinet[,2]
alpha_i <- cabinet[,1]
S <- 6
constrained <- cbind(z_i, alpha_i, S, z_pm[i], mean(alpha_i),sd(z_i))
bucket5<- rbind(bucket5, constrained)
}
plot(1, type="l", xlab=expression(italic(z[pm])),
ylab=expression(italic(mean(alpha[i](cabinet)))), xlim=range(z_pm),
ylim=c(0,1), col=NULL)
points(bucket5[,4][bucket5[,3]==1],bucket5[,5][bucket5[,3]==1],col='grey')
points(bucket5[,4][bucket5[,3]==1],bucket5[,5][bucket5[,3]==6],pch=2,col='grey')
lo1<-loess(bucket5[,5][bucket5[,3]==1]~bucket5[,4][bucket5[,3]==1],
span=1)
lines(lo1$x,lo1$fitted,lwd=1.5, lty=1)
lo6<-loess(bucket5[,5][bucket5[,3]==6]~bucket5[,4][bucket5[,3]==6],
span=1)
lines(lo6$x,lo6$fitted,lwd=1.5, lty=2)
mtext(expression(paste( italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
mtext('e', col='grey', line = -1, side=1, adj=0.99)
legend('bottomleft', c(expression(italic(S==1)), expression(italic(S==6))),
pch=c(1,2),
bty='n',ncol=2,col = 'grey',cex=1)
plot(1, type="l", xlab=expression(italic(z[pm])),
ylab=expression(italic(sd(z[i](cabinet)))), xlim=range(z_pm),
ylim=c(0,25), col=NULL)
points(bucket5[,4][bucket5[,3]==1],bucket5[,6][bucket5[,3]==1], col='grey')
points(bucket5[,4][bucket5[,3]==1],bucket5[,6][bucket5[,3]==6],pch=2, col='grey')
mtext(expression(paste( italic(lambda)==10,
",  ", italic(k)==12, ",  ",
italic(N)==100)), line=.0001)
lo1<-loess(bucket5[,6][bucket5[,3]==1]~bucket5[,4][bucket5[,3]==1],
span=1)
lines(lo1$x,lo1$fitted,lwd=1.5,lty=1)
lo6<-loess(bucket5[,6][bucket5[,3]==6]~bucket5[,4][bucket5[,3]==6],
span=1)
lines(lo6$x,lo6$fitted,lwd=1, lty=2)
mtext('f', col='grey', line = -1, side=1, adj=0.99)
path <- 'C:/Users/patle/Desktop/APSR_SKLLO_Repfiles'
path <- 'C:/Users/patle/Desktop/APSR_SKLLO_Repfiles/'
setwd(path)
load("CalcData/rebeldta9297.Rda")
load("CalcData/rebeldta0510.Rda")
groupsdta <- read.csv(paste(path,"RawData/groupmembership.csv",sep=""))
